package org.dawn.deveco.plugin.resourceeditor.test.buttonTest;

import javax.swing.*;
import javax.swing.table.TableCellRenderer;
import java.awt.*;

@SuppressWarnings("serial")
class ButtonRenderer extends JButton implements TableCellRenderer {

    public JComponent getTableCellRendererComponent(JTable table, Object value,
                                                    boolean isSelected, boolean hasFocus, int row, int column) {
        //value 源于editor
        String text = (value == null) ? "" : value.toString();
        //按钮文字
        setText(text);
        //单元格提示
        setToolTipText(text);
        //背景色
        setBackground(Color.BLACK);
        //前景色
        setForeground(Color.green);
        return this;
    }
}